<template>
  <div>
    <AplidForm ref="formRef" v-bind="BaseFormConfig" v-model="formModel" @submit="onSubmit" @reset="back"> </AplidForm>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import apiMod from '@/apiMod'
const emit = defineEmits(['refresh', 'back'])

type Props = {
  nowRowData?: any
}
let props = withDefaults(defineProps<Props>(), {
  nowRowData: {}
})

let formModel: any = {}
let formRef = ref()

let BaseFormConfig = {
  inline: false,
  labelPosition: 'left',
  labelWidth: 100,
  column: [
    { label: '备注', prop: 'rejectRemark', type: 'textarea', span: 22 },
  ],
}

const onSubmit = (form, done) => {
  console.log(form, done, '未处理提交数据');
  let params = {
    ...props.nowRowData, approveResult: 0, approveStatus: 1, ...form
  }
  apiMod.view_iccVeinApprove_edit(params).then(res => {
    done()
    emit('refresh')
  }).catch(() => {
    done()
  })
}
const back = () => {
  emit('back')
}

const onSave = () => {
  formRef.value!.onSubmit()
}
defineExpose({
  onSave,
})
</script>

<style scoped></style>
